﻿using System;
using wojilu.ORM;
using wojilu.Web.Mvc;

namespace wojilu.Apps.Qycms.Domain
{
    [Table("ybb_subjectlist")]
    [Serializable]
    public class SubjectList : ObjectBase<SubjectList>
    {
        [NotNull(""), Default(0), Column(Length = 10)]
        public Int32 pid { get; set; }

        [NotNull(""), Default(0), Column(Length = 5)]
        public Int32 mid { get; set; }

        [NotNull(""), Default("cn"), Column(Length = 50)]
        public String lng { get; set; }

        [NotNull(""), Column(Length = 150)]
        public String subjectname { get; set; }

        [NotNull(""), Column(Length = 200)]
        public String headtitle { get; set; }

        [NotNull(""), Column(Length = 80)]
        public String keywords { get; set; }

        [NotNull(""), Column(Length = 200)]
        public String description { get; set; }

        [LongText, NotNull("")]
        public String content { get; set; }

        [NotNull(""), Default(""), Column(Length = 200)]
        public String subpic { get; set; }

        [NotNull(""), Default(""), Column(Length = 150)]
        public String dirname { get; set; }

        [TinyInt, NotNull(""), Default(1), Column(Length = 1)]
        public Int32 purview { get; set; }

        [TinyInt, NotNull(""), Default(1), Column(Length = 1)]
        public Int32 isclass { get; set; }

        [TinyInt, NotNull(""), Default(1), Column(Length = 1)]
        public Int32 styleid { get; set; }

        [TinyInt, NotNull(""), Default(1), Column(Length = 1)]
        public Int32 ishtml { get; set; }

        [TinyInt, NotNull(""), Default(0), Column(Length = 1)]
        public Int32 iswap { get; set; }

        [NotNull(""), Column(Length = 100)]
        public String waptempalte { get; set; }

        [NotNull(""), Column(Length = 100)]
        public String indextemplates { get; set; }

        [NotNull(""), Column(Length = 100)]
        public String template { get; set; }

        [NotNull(""), Column(Length = 100)]
        public String filenamestyle { get; set; }

        [NotNull(""), Column(Length = 200)]
        public String dirpath { get; set; }

        [NotNull(""), Default(0), Column(Length = 5)]
        public Int32 pagemax { get; set; }

        [NotNull("")]
        public DateTime addtime { get; set; }

        [NotSave]
        public String glink
        {
            get
            {
                return strUtil.Join(strUtil.Join(strUtil.Join(sys.Path.Root, "Article"), "Subject"), Id.ToString()) + MvcConfig.Instance.UrlExt;
            }
        }

        [NotSave]
        public String puvname
        {
            get
            {
                if (purview == 0)
                {
                    return wojilu.lang.get("puv_no");
                }
                else
                {
                    var mc = Member_Class.findById(purview);
                    return mc.rankname;
                }
            }
        }

        [NotSave]
        public String modelname
        {
            get
            {
                Model m = Model.findById(mid);
                return m.modelname;
            }
        }

    }
}
